package es.deusto.ingenieria.sd.sms.client.controller;


import java.rmi.RemoteException;




import java.util.List;

import sun.print.resources.serviceui_zh_CN;
import es.deusto.ingenieria.sd.sms.client.remote.RMIServiceLocator;

public class PlayController {
	@SuppressWarnings("unused")
	private RMIServiceLocator rsl;
	
	
	public PlayController(String[] args) throws RemoteException {
		// Add your code HERE - Related to the Service Locator
		
		//new switchServerGUI(this);
		
	}
	
	public void switchServer(String ip, String port, String name){
		// Add your code HERE - Related to switching servers
		switchServer(ip, port, name);
		
		System.out.println("- Switching to server: " + ip + ":" + port + "/" + name);
		
	}
	
    public void play(String userId, String idSong){
    	/*try {
    		
    		// Add your code HERE - Related to getting the service and requesting creation of TVProgram	
    		
    		newPlay(userId, idSong);
    	} catch (Exception e){
    		System.err.println("$ Error splaying Song: " + e.getMessage());
    	}*/
    }
    
    public void pause(){
    	/*try{
    		
    		
    		
    	} catch(Exception e){
    		System.out.println("$ Error sending a message: " + e.getMessage());
    	}*/
    }
  
    public void stop(){
    
    }
    public Song searchSong(List <Song> s, String title)
    {
    	int i=0;
    	boolean enc=false;
    	while(i<s.size() || !enc)
    	{
    		if(s[i].getTitle().equals(title))
    		{
    			enc=true;
    			Song song= s[i].getSong();
    		}
    		else
    			i++;
    	}
    	
    }

    public void exit(){
    	System.exit(0);
    }
    
    public static void main(String[] args) throws RemoteException {    	
    	new PlayController(args);

		

    }
}